#ifndef GAMEENGINE_MAPS_DICE_H
#define GAMEENGINE_MAPS_DICE_H

#include <GameEngine/Gameplay/gameplay_settings.h>

#include <GameEngine/Core/mersenne_twister.h>



#ifdef GAMEENGINE_NAMESPACES
namespace GameEngine {
#endif

//=================================================================================


//! Implementation of a dice
/*!
 *  The dice class aims at representing a standard dice, whose faces all have the same
 *  probability to appear when the dice is thrown (as opposed to crooked dice, whose
 *  faces do not appear with equal probability).
 *
 *  This class practically allows to represent dice with any number of faces, from 1 to
 *  infinity, even those that do not have any natural physical polyhedron (for instance,
 *  this class allows to represent dice with three faces, even if no one ever saw such a
 *  dice in the real world). Some utility functions allow to build the most common types
 *  of dice, i.e. dice with 4, 6, 8, 10, 12 and 20 faces.
 */
class _Gameplay_decl Dice {

public:
	Dice(unsigned int faces=6);
	Dice(const Dice& rhs);
	Dice& operator=(const Dice& rhs);
	virtual ~Dice();

	unsigned int faces() const;
	void set_faces(unsigned int faces);

	unsigned int roll_dice() const;

	static Dice dice4();
	static Dice dice6();
	static Dice dice8();
	static Dice dice10();
	static Dice dice12();
	static Dice dice20();

protected:
	//! The number of faces of the dice
	unsigned int faces_;

	//! Random number generator associated to the dice
	static MTRand rand_;
};

//========================================================

#ifdef GAMEENGINE_NAMESPACES
} // namespace GameEngine
#endif

#endif
